/**
 * validateCost.js
 * v0.01
 * 2/20/2011
 * 
 * The function checks inputs and returns a truth value if those inputs are
 * not numbers.
 * @returns {Boolean}
 */

function checkInput(){
	var id;				//id: refer to createAnalysis.php
	var i;				
	var flag = 0;		//For error checking: 0-no error

	for(i = 0; i < 8; i++){
		switch(i){
			case 0: id = "AshCost"; break;
			case 1: id = "CrudeFatCost"; break;
			case 2: id = "CrudeFiberCost"; break;
			case 3: id = "CrudeProteinCost"; break;
			case 4: id = "MoistureCost"; break;
			case 5: id = "ProxAnalysisAllCost"; break;
			case 6: id = "ProxAnalysisCompCost"; break;
			case 7: id = "SamplePrepCost"; break;
		}
		
		//If input is not a number						
		if(isNaN(document.getElementById(id).value)){
			document.getElementById("error"+id).innerHTML = "Not a number.";		
			flag=1;
		}
	}
	return false;
}